package com.example.big_orange2.common;

import com.example.big_orange2.entity.Staff;
import com.example.big_orange2.entity.uiddata;

//用来返回操作结果和设置返回操作情况，比如在数据库操作+request.success(）如果操作没问题就会执行requset.success(）返回成功结果。
public class Result<T> {
    private String code;
    private String msg;
    private T data;
    private Staff data1;
    private uiddata data2;
    private String result;
    private String message;
    private String token;


    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }


    public Staff getData1() {
        return data1;
    }

    public void setData1(Staff data1) {
        this.data1 = data1;
    }

    public uiddata getData2() {
        return data2;
    }

    public void setData2(uiddata data2) {
        this.data2 = data2;
    }
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
    public String getCode() {
        return code;
    }

    public void setToken(String token) {
        this.token = token;
    }
    public String getToken() {
        return token;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }


    public Result() {
    }

    public Result(T data) {
        this.data = data;
    }

    public static com.example.big_orange2.common.Result success() {
        com.example.big_orange2.common.Result result = new com.example.big_orange2.common.Result<>();
        result.setCode("200");
        result.setMsg("成功");
        return result;
    }

    public static <T> com.example.big_orange2.common.Result<T> success(T data) {
        com.example.big_orange2.common.Result<T> result = new com.example.big_orange2.common.Result<>(data);
        result.setCode("200");
        result.setMsg("成功");
        return result;
    }

    public static com.example.big_orange2.common.Result error(String code, String msg) {
        com.example.big_orange2.common.Result result = new com.example.big_orange2.common.Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
